import src.login as login  # 导入登录模块
import src.util.nacos.nacos_client as nacos_client  # 导入nacos配置管理模块
from src.util.log_util.log import logging  # 导入日志模块方便调试和追踪错误
from datetime import datetime
import time
import src.util.apscheduler.apscheduler as scheduler_service

# 定义日志消息函数，将信息与当前时间戳记录
def log_message(message):
    current_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
    logging.info(message + current_time)

log_message("系统启动------->")

def main():
    try:
        # 启动定时任务    
        scheduler_service.init_scheduler()
    except Exception as e:
        log_message("调度器启动异常: ")
        logging.exception(e)  # 记录异常信息以便调试
        time.sleep(5)  # 发生异常后等待5秒
main()
# if __name__ == "__main__":
#     while True:
#         main()